package com.example.module_maintenance.viewmodel

import androidx.lifecycle.MutableLiveData
import com.bw.lib_common.coroutine.CoroutineHelper
import com.bw.lib_common.vm.BaseViewModel2
import com.example.module_maintenance.entity.CultureEntity
import com.example.module_maintenance.repo.CultureRepo
import kotlinx.coroutines.launch

class CultureViewModel :BaseViewModel2<CultureRepo>(){


    val getCultureSuccess by lazy { MutableLiveData<List<CultureEntity>>() }

    fun getCulture(){
        CoroutineHelper.mViewModelScope.launch ( CoroutineHelper.mDispatcher ){
            val result = mRepository.getCulture()
            if (result.code == 200){
                getCultureSuccess.postValue(result.data)
            }else{
                mErrorLiveData.postValue("获取数据异常")
            }
        }
    }







    override fun createRepository(): CultureRepo  = CultureRepo()
}